package cn.lsc._03_oneway;


import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

public class Producer3 {
    public static void main(String[] args) throws Exception {
        // 实例化消息生产者Producer
        DefaultMQProducer producer = new DefaultMQProducer("oneway_producer_group");
        // 设置NameServer的地址
        producer.setNamesrvAddr("localhost:9876");
        // 启动Producer实例
        producer.start();
        Message message = new Message("oneway", "wangdefa", "没错还是我在摸鱼！".getBytes(StandardCharsets.UTF_8));
        producer.send(message);
        producer.shutdown();
    }
}
